import { request } from "@/utils/http";
import {Key}  from  'react'

import type {
  getHosSetListParamsType,
  getHosSetListReturnType,
  addHospitalParamType,
  getHosSetFromIdRequestType,
  getHosSetListItemsType
} from "./model/hospitalSetTypes";

//医院设置中 获取分页列表
export const getHosSetListRequest = ({ page, limit, hosname, hoscode }: getHosSetListParamsType) => {
  return request.get<any, getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
    params: {
      hosname,
      hoscode
    }
  })
}
//添加医院的post请求
export const addHospitalRequest = (data:addHospitalParamType)=>{
  return request.post("/admin/hosp/hospitalSet/save",data)
}
//点击修改获取对应id值的数据的get请求
export const getHosSetFromIdRequest = (id:number)=>{
  return request.get<any,getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}
//修改医院的put请求
export const updateHosipitalRequest =(data:getHosSetFromIdRequestType)=>{
  return request.put<any, null>('/admin/hosp/hospitalSet/update',data)
}
//删除医院的delete请求
export const deleteHospitalRequest =(id:number)=>{
  return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`)
}
//批量删除医院的delete请求
export const deleteAllHospitalRequest =(ids:Key[])=>{
  return request.delete<any,null>('/admin/hosp/hospitalSet/batchRemove',{
    data:ids
  })
}